import 'dart:math';

import 'package:flutter/material.dart';
import 'package:kq_flutter_tv_widgets/widgets/breadCrumbs/kq_bread_crumbs.dart';

/// 面包屑Demo
class BreadCrumbsDemoPage extends StatefulWidget {
  const BreadCrumbsDemoPage({super.key});

  @override
  State<StatefulWidget> createState() => _BreadCrumbsDemoPageState();
}

class _BreadCrumbsDemoPageState extends State<BreadCrumbsDemoPage> {
  List<ICrumbs> crumbs = [];
  Random random = Random();
  Color colorParent = Colors.blueAccent;
  Color colorChild = Colors.grey;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          TextButton(
              onPressed: () {
                crumbs.add(ICrumbs(random.nextInt(1000).toString()));
                setState(() {});
              },
              child: const Text("增加目录")),
          TextButton(
              onPressed: () {
                colorParent = Colors.redAccent;
                setState(() {});
              },
              child: const Text("调整可点击颜色")),
          TextButton(
              onPressed: () {
                colorChild = Colors.greenAccent;
                setState(() {});
              },
              child: const Text("调整普通文本颜色颜色")),
          KqBreadCrumbs<ICrumbs>(
            crumbs: crumbs,
            colorParent: colorParent,
            colorChild: colorChild,
            onTap: (int index,ICrumbs entity){

            },
          )
        ],
      ),
    );
  }
}
